<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>魅力值等级列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="/web/res/css/xadmin.css">
    <script src="/web/res/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/web/res/js/xadmin.js"></script>
    <script type="text/javascript" src="/web/res/js/common.js"></script>
</head>

<body>
<div class="x-nav">
        <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">聊天收费管理</a>
            <a><cite>配置列表</cite></a>
        </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <div class="layui-input-inline layui-show-xs-block" style="margin-bottom: 10px">
                        <button class="layui-btn layui-btn-xs layui-btn-danger" onclick="xadmin.open('添加','/after/prise/gotoAdd',800,600)" >
                            <i class="layui-icon">+</i>添加配置
                        </button>
                    </div>
                    <!--查询条件-->
                    <form class="layui-form layui-col-space5" type="post" id="room"  action="/after/prise/list">
<!--                        <div class="layui-input-inline layui-show-xs-block">-->
<!--                            <input type="text" name="level"  value="${level!''}"  placeholder="等级" autocomplete="off" class="layui-input">-->
<!--                        </div>-->

                            <div class="layui-input-inline layui-show-xs-block">
                                <select name="type" id="type">
                                    <option value="">类型</option>
                                    <option value="1" <#if type?exists && type?exists><#if (type)?number == 1?number>selected</#if></#if> >消息价格</option>
                                    <option value="2" <#if type?exists && type?exists><#if (type)?number == 2?number>selected</#if></#if> >语音价格</option>
                                    <option value="3" <#if type?exists && type?exists><#if (type)?number == 3?number>selected</#if></#if> >视频价格</option>
                                </select>
                            </div>
                        <div class="layui-input-inline layui-show-xs-block">
                            <button class="layui-btn"  lay-submit lay-filter="search" >
                                <i class="layui-icon">&#xe615;</i>搜索
                            </button>
                        </div>
                    </form>
                </div>
                <div class="layui-card-body" style="overflow:auto">
                    <table class="layui-table layui-tables layui-form tableH"  style="min-width: 100% !important; "  lay-size="sm"  id="tab">
                        <thead>
                        <tr>
                            <th>价格</th>
                            <th>是否有魅力值限制</th>
                            <th>魅力值等级限制</th>
                            <th>类型</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <#if list?? && (list?size > 0) >
                        <#list list as user>
                        <tr>
                            <td>${(user.price)!''}</td>
                            <td><#if user.charmLevel?exists && (user.charmLevel)?number == 0><span style="color: orange;">否</span>
                                <#elseif user.charmLevel?exists && (user.charmLevel)?number == 1><span style="color: green;">是</span>
                            </#if></td>
                            <td>${(user.charmLevelCondition)!'暂无'}</td>
                            <td><#if user.type?exists && (user.type)?number == 1><span>消息价格</span>
                                <#elseif user.type?exists && (user.type)?number == 2><span>语音价格</span>
                                <#elseif user.type?exists && (user.type)?number == 3><span>视频价格</span>
                            </#if></td>
                            <td class="td-manage btn-center">
                                <button class="layui-btn layui-btn-xs layui-btn-warm" onclick="xadmin.open('编辑','/after/prise/detail?id=${(user.id)!''}',800,600)" >
                                    <i class="layui-icon layui-icon-edit"></i>编辑
                                </button>
                                <button class="layui-btn layui-btn-xs layui-btn-danger" onclick="del(this,'${user.id}',1)">
                                    <i class="layui-icon layui-icon-delete"></i>删除
                                </button>
                            </td>
                        </tr>
                        </#list>
                        <#else>
                        <tr>
                            <td colspan="20" style="text-align: center;">暂无记录</td>
                        </tr>
                    </#if>
                    </tbody>
                    </table>
                </div>
                <!-- 分页条 -->
                <div id="pager" style="text-align: center;"></div>
            </div>
        </div>
    </div>
</div>
</body>

<script>
    layui.use(['laydate', 'form', 'table'], function () {
        let $ = layui.$;
        var laydate = layui.laydate;
        var form = layui.form;
        var table = layui.table;
        var carousel = layui.carousel;
        //执行一个laydate实例
        laydate.render({
            elem: '#startdate' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#enddate' //指定元素
        });

        $(".img_biges").click(function(){
            var url = $(this).attr('title');
            var xbcmz =url.split(',');
            $.each(xbcmz, function (index, item) {
                showimg(item)
            })
        });


    });
    // 删除该魅力值
    function del(obj, id) {
        console.log(obj, id)
        layui.use('layer',function () {
            let $ = layui.$;
            layer.confirm('确认要删除该价格配置？', function (index) {
                ajaxPost($,"/after/prise/del",{'id':id},function (data) {
                    if (data.code == 0) {
                        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
                            location.reload();
                        });
                    } else {
                        layer.msg(data.msg, {icon: 2, time: 1000}, function(){
                        });
                    }
                });
            });
        });
    }
    // 推荐
    function recommend(obj, id) {
        console.log(obj, id)
        layui.use('layer',function () {
            let $ = layui.$;
            layer.confirm('是否推荐该直播？', function (index) {
                ajaxPost($,"/after/live/loveLive",{'liveId':id},function (data) {
                    if (data.code == 0) {
                        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
                            location.reload();
                        });
                    } else {
                        layer.msg(data.msg, {icon: 2, time: 1000}, function(){
                        });
                    }
                });
            });
        });
    }

</script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use(['laypage', 'layer', 'form'], function(){
        let $ = layui.$;
        var laypage = layui.laypage
            ,form = layui.form
            ,layer = layui.layer;

        laypage.render({
            elem: 'pager'
            ,count: ${(splitPage.totalCount?c)!''}
            ,limit: ${(splitPage.pageSize?c)!''}
            ,curr: ${(splitPage.pageIndex?c)!''}
            ,layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
            ,jump: function(obj, first){
                console.log('obj2, first2',obj, first);

                //首次不执行
                if(!first){
                    var myform = document.forms[0];
                    // alert("formName:"+myform.id,${(splitPage.totalCount?c)!''},${(splitPage.pageSize?c)!''},${(splitPage.pageIndex?c)!''});
                    var pageIndex = document.createElement("input");
                    pageIndex.name="pageIndex";
                    pageIndex.type="hidden";
                    pageIndex.value=obj.curr;
                    myform.appendChild(pageIndex);

                    var pageSize = document.createElement("input");
                    pageSize.name="pageSize";
                    pageSize.type="hidden";
                    pageSize.value=obj.limit;
                    myform.appendChild(pageSize);
                    $("button[lay-submit]:eq(0)").click();
                }
            }
        });
    });
</script>


</html>